import React, { Component } from 'react'
import {Modal,Input,Cascader} from 'antd'
// import {addCategory} from '../../api'

const InputGroup = Input.Group;



const options = [
  {
    value: '一级分类',
    label: '一级分类',
  },
  {
    value: '二级分类',
    label: '二级分类',
  },
];

 class oneLevelCatogray extends Component {

   state={
     InputValue:''
   }

  async componentDidMount(){

 }
 handleGetInputValue=(e)=>{


   this.setState({
    InputValue: e.target.value
   })

   console.log('imput===>',e.target.value)

 }

//  |parentId      |Y       |string   |父级分类的ID
// |categoryName  |Y       |string   |名称

  render() {
    const {visible,onOk,onCancel} = this.props
    const {InputValue} = this.state
    return (
      <div>
         <Modal
          title="添加商品"
          visible={visible}
          onOk={onOk}
          onCancel={ onCancel }
        >
          <InputGroup compact>
            <label>所属分类：</label>
          <Cascader 
          style={{ width: '70%' }} 
          options={options}
           placeholder="请选择所属分类" />
         <br />
          <label style={{marginTop:'35px'}}>商品名称：</label>
          <Input 
          placeholder="商品名称" 
           style={{width: '330px',marginTop:'30px'}}
           value={InputValue}
           onChange={this.handleGetInputValue}
          
          />
        </InputGroup>
        </Modal>
      </div>
    )
  }
}

export default oneLevelCatogray
